﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="role_add.aspx.cs" Inherits="Web_Admin_Admin_role_add" %>

<%@ Register Src="../ascx/navigation.ascx" TagName="navigation" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>角色添加</title>
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../css/default.css" />
    <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../js/jquery.validate.js"></script>
    <script type="text/javascript">
        //全选、反选
        function select_All(obj) {
            var chk = $(obj).attr("checked");
            $("#tb_list [name=chk_ids]").attr("checked", chk);
        }

        //验证
        $().ready(function() {
            $("#form1").validate({
                rules: {
                    txt_RoleName: { required: true },
                    txt_Ordinal: { required: true, digits:true }
                },
                messages: {
                    txt_RoleName: { required: "角色名称不能为空" },
                    txt_Ordinal: { required: "排序不能为空", digits: "排序必须为整数" }
                },
                errorElement: "em",
                errorPlacement: function(error, element) {
                    error.appendTo(element.parent());
                }
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <uc1:navigation ID="navigation1" Title="角色管理" runat="server" />
    <div class="adRbox">
        <div class="arTabBox arFmtd">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th class="fmth"><asp:Literal ID="lit_title" Text="角色管理" runat="server"></asp:Literal></th>
                    <th>&nbsp;</th>
                </tr>
                <tr>
                    <td class="addtd">角色类型：</td>
                    <td>
                        <asp:DropDownList ID="drpClass" DataTextField="RoleName" DataValueField="ID" AppendDataBoundItems="true" runat="server" onchange="window.location.href='?id='+this.value;">
                            <asp:ListItem Text="--请选择--" Value=""></asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;&nbsp;<asp:LinkButton ID="link_del" runat="server" onclick="link_del_Click">删除</asp:LinkButton>
                    </td>
                </tr>
                <tr>
                    <td class="addtd">角色名称：</td>
                    <td><asp:TextBox ID="txt_RoleName" CssClass="ipt1" runat="server"></asp:TextBox>&nbsp;<em>*</em>&nbsp;</td>
                </tr>
                <tr>
                    <td class="addtd">排序：</td>
                    <td><asp:TextBox ID="txt_Ordinal" Text="0" CssClass="ipt1" Width="50px" runat="server"></asp:TextBox>&nbsp;<em>*</em>&nbsp;</td>
                </tr>
                <tr>
                    <td class="addtd">权限管理：</td>
                    <td>
                        <table id="tb_list" border="0" cellpadding="0" cellspacing="0" width="100%" class="mk_tab">
                        <tr>
                            <td colspan="2">
                            <table>
                                <tr>
                                    <td><input id="chk_All" name="checkboxs" type="checkbox" onclick="select_All(this);" /></td>
                                    <td>全选</td>
                                </tr>
                            </table>
                            </td>
                        </tr>
                        <asp:Repeater ID="rpList" runat="server">
                            <ItemTemplate>
                            <tr>
                                <td class="mk_name"><%# Eval("Name")%>：</td>
                                <td>
                                    <div class="mk_list" style="width:550px;">
                                        <%# getRoleList(Eval("PermmissionList"),Eval("ID"))%>
                                    </div>
                                </td>
                            </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="addtd">
            &nbsp;
                    </td>
                    <td class="fmBtns">
                        <label>
                            <asp:Button ID="but_save" runat="server" Text="保存" onclick="but_save_Click" />
                            <asp:Button ID="but_assave" runat="server" Text="另存为" 
                            onclick="but_assave_Click" />
                            <input type="submit" name="button3" id="button3" value="返回" onclick="history.back();" />
                        </label>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    </form>
</body>
</html>
